/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.fee.service;

import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.modules.fee.entity.Receivables;
import com.jeeplus.modules.fee.mapper.ReceivablesMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 应收结算单Service
 * @author weisong
 * @version 2017-09-22
 */
@Service
@Transactional(readOnly = true)
public class ReceivablesService extends CrudService<ReceivablesMapper, Receivables> {

	public Receivables get(String id) {
		return super.get(id);
	}
	
	public List<Receivables> findList(Receivables receivables) {
		return super.findList(receivables);
	}
	
	public Page<Receivables> findPage(Page<Receivables> page, Receivables receivables) {
		return super.findPage(page, receivables);
	}
	
	@Transactional(readOnly = false)
	public void save(Receivables receivables) {
		super.save(receivables);
	}
	
	@Transactional(readOnly = false)
	public void delete(Receivables receivables) {
		super.delete(receivables);
	}

	// 查询最大的单号和日期【用来生成单号】
	public Receivables findClearingNoAndBusyDate() {
		return mapper.findClearingNoAndBusyDate();
	}

	//根据id更新状态
	@Transactional(readOnly = false)
	public int updateStatusAndMoneyById(Integer status, Double invoiceMoney,
										Double vcaMoney,Double noInvoiceMoney,Double noVcaMoney, String id) {
		return mapper.updateStatusAndMoneyById(status,invoiceMoney,vcaMoney,noInvoiceMoney,noVcaMoney, id);
	}

	//根据收款单子表id查询对应的应收结算单
	public Receivables findByBillDetailId(String id){
		return mapper.findByBillDetailId(id);
	}

	//收款单引入已确认的数据
	public List<Receivables> findAllByStatus(String payerName,Integer status){
		return mapper.findAllByStatus(payerName,status);
	}
}